package com.xsmart.oa.api;

import com.xsmart.common.entity.RequestBean;
import com.xsmart.oa.services.AdminPowerSettingService;
import org.apache.catalina.servlet4preview.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/api/")
public class AdminPowerSettingController {

    @Autowired
    AdminPowerSettingService adminPowerSettingService;

    @RequestMapping(value = "/v1/AdminPowerSettingService/queryAdminPowerList", method = RequestMethod.POST)
    @ResponseBody
    public Object queryAdminPowerList(@ModelAttribute RequestBean requestBean, HttpServletRequest request) {
        return adminPowerSettingService.queryAdminPowerList(requestBean);
    }

    @RequestMapping(value = "/v1/AdminPowerSettingService/updateAdminPower", method = RequestMethod.POST)
    @ResponseBody
    public Object updateAdminPower(@ModelAttribute RequestBean requestBean, HttpServletRequest request) {
        return adminPowerSettingService.updateAdminPower(requestBean);
    }

    /**
     * 查询所有的权限列表
     * @param requestBean
     * @param request
     * @return
     */
    @RequestMapping(value="/v1/AdminPowerSettingService/queryAllPowerList",method=RequestMethod.POST)
    @ResponseBody
    public Object queryAllPowerList(@ModelAttribute RequestBean requestBean,HttpServletRequest request){
        return adminPowerSettingService.queryAllPowerList(requestBean);
    }

    /**
     * 查询管理员管理的所有的商家
     * @param requestBean
     * @param httpServletRequest
     * @return
     */
    @RequestMapping(value="/v1/AdminPowerSettingService/queryAllSeller",method = RequestMethod.POST)
    @ResponseBody
    public Object queryAllSeller(@ModelAttribute RequestBean requestBean, javax.servlet.http.HttpServletRequest httpServletRequest){
        return adminPowerSettingService.queryAllSeller(requestBean);
    }

    /**
     * 查询所有的商家
     * @param requestBean
     * @param httpServletRequest
     * @return
     */
    @RequestMapping(value="/v1/AdminPowerSettingService/allSeller",method = RequestMethod.POST)
    @ResponseBody
    public Object allSeller(@ModelAttribute RequestBean requestBean, javax.servlet.http.HttpServletRequest httpServletRequest){
        return adminPowerSettingService.allSeller(requestBean);
    }

    @RequestMapping(value="/v1/AdminPowerSettingService/submitSeller",method = RequestMethod.POST)
    @ResponseBody
    public Object submitSeller(@ModelAttribute RequestBean requestBean, javax.servlet.http.HttpServletRequest httpServletRequest){
        return adminPowerSettingService.updateInfuAdminSellerRel(requestBean);
    }
}
